package com.myjava.linkedhashset;

import java.util.HashMap;

public class HashMapdemo {
    public static void main(String[] args) {
        String str="aaabbbbccc";
        char[] ch= str.toCharArray();
        HashMap<Character, Integer> hs = new HashMap<>();
        for (char c:ch) {
            if(!hs.containsKey(c)){
                hs.put(c,1);
            }else{
                hs.put(c,hs.get(c)+1);
            }

        }
        System.out.println(hs);
    }
}
